<template>
	<view class="rounded-lg bg-white p-20 mb-20" @click="handleGoDetail(val)">
		<template v-if="isAch == 1">
			<view class="flex justify-between">
				<view class="flex items-center">
					<view class="w-[100rpx] h-[100rpx] rounded-lg overflow-hidden" v-if="val?.member?.ach == 1"
						@click.stop="handleGoUser(`/pages/user/anchor?id=${val?.member?.anchor.id}`, val?.member?.anchor.id, val?.member?.ach)">
						<ImageBoxVue :src="val?.member?.anchor.headimg"></ImageBoxVue>
					</view>
					<view class="w-[100rpx] h-[100rpx] rounded-lg overflow-hidden" v-else
						@click.stop="handleGoUser(`/pages/user/user?id=${val?.member?.id}`, val?.member?.id, val?.member?.ach)">
						<ImageBoxVue :src="val?.member?.headimg"></ImageBoxVue>
					</view>
					<view class="pl-20">
						<view class="flex" v-if="val?.member?.ach == 1">
							<text class="w-120 ellipsis">{{val.member?.anchor.name}}</text>
							<view class="ml-10 bg-gradient-to-r from-[#FF9562] to-[#FFBB55] py-4 px-8 rounded-sm">
								<text class="text-white font-bold">LV.{{val.member?.anchor.achorlevel.lev}}</text>
							</view>
						</view>
						<view class="flex" v-else>
							<text class="w-120 ellipsis">{{val?.member?.nickname}}</text>
							<view class="ml-10 bg-gradient-to-r from-[#FF9562] to-[#FFBB55] py-4 px-8 rounded-sm">
								<text class="text-white font-bold">LV.{{val?.member?.openlev}}</text>
							</view>
						</view>
						<view class="flex items-center">
							<ImageBoxVue :src="val?.paysts==0?'/static/icons/blue.png':'/static/icons/red.png'" width="28rpx"
								height="28rpx">
							</ImageBoxVue>
							<text class="ml-10">{{val?.sinpay}}钻</text>
						</view>
					</view>
				</view>
			</view>
			<!--  -->
			<view class="mt-20">
				<text class="font-bold">问题：</text>
				<text>{{val?.describe}}</text>
			</view>
			<view class="mt-20" v-if="val?.replenishment">
				<text class="font-bold">补充说明：</text>
				<text>{{val?.replenishment}}</text>
			</view>
		</template>
		<template v-else>
			<view class="flex justify-between">
				<view class="flex items-center">
					<view class="w-[100rpx] h-[100rpx] rounded-lg overflow-hidden" v-if="val?.member?.ach == 1"
						@click.stop="handleGoUser(`/pages/user/anchor?id=${val?.member?.anchor.id}`, val?.member?.anchor.id, val?.member?.ach)">
						<ImageBoxVue :src="val?.member?.anchor.headimg"></ImageBoxVue>
					</view>
					<view class="w-[100rpx] h-[100rpx] rounded-lg overflow-hidden" v-else
						@click.stop="handleGoUser(`/pages/user/user?id=${val?.member?.id}`, val?.member?.id, val?.member?.ach)">
						<ImageBoxVue :src="val?.member?.headimg"></ImageBoxVue>
					</view>
					<view class="pl-20">
						<view class="flex" v-if="val?.member?.ach == 1">
							<text class="w-120 ellipsis">{{val.member?.anchor.name}}</text>
							<view class="ml-10 bg-gradient-to-r from-[#FF9562] to-[#FFBB55] py-4 px-8 rounded-sm">
								<text class="text-white font-bold">LV.{{val.member?.anchor.achorlevel.lev}}</text>
							</view>
						</view>
						<view class="flex" v-else>
							<text class="w-120 ellipsis">{{val?.member?.nickname}}</text>
							<view class="ml-10 bg-gradient-to-r from-[#FF9562] to-[#FFBB55] py-4 px-8 rounded-sm">
								<text class="text-white font-bold">LV.{{val?.member?.openlev}}</text>
							</view>
						</view>
						<view class="flex items-center">
							<ImageBoxVue :src="val?.paysts==0?'/static/icons/blue.png':'/static/icons/red.png'" width="28rpx"
								height="28rpx">
							</ImageBoxVue>
							<text class="ml-10">{{val?.sinpay}}钻</text>
						</view>
					</view>
				</view>
			</view>
			<!--  -->
			<view class="mt-20">
				<text class="font-bold">问题：</text>
				<text>{{val?.describe}}</text>
			</view>
			<view class="mt-20" v-if="val?.replenishment">
				<text class="font-bold">补充说明：</text>
				<text>{{val?.replenishment}}</text>
			</view>
		</template>

	</view>
</template>

<script setup>
	import {
		ref,
		provide,
	} from 'vue';
	const {
		val
	} = defineProps(['val'])
	const emit = defineEmits(['onReply'])

	provide('val', val)

	const isAch = ref(0)
	isAch.value = uni.getStorageSync('user').ach

	const handleGoDetail = (val) => {
		if (val.posts == 1) {
			uni.navigateTo({
				url: `/pages/test/quickDetailsPsychology?id=${val.id}`
			})
		} else if (val.posts == 2) {
			uni.navigateTo({
				url: `/pages/test/quickDetailsPsychology?id=${val.id}`
			})
		} else if (val.posts == 3) {
			if (val.exmk == 0) {
				uni.navigateTo({
					url: `/pages/test/quickDetails?id=${val.id}`
				})
			} else if (val.exmk == 1) {
				uni.navigateTo({
					url: `/pages/test/quickDetailsCard?id=${val.id}`
				})
			} else if (val.exmk == 2) {
				uni.navigateTo({
					url: `/pages/test/quickDetailsCard?id=${val.id}`
				})
			}
		} else {
			uni.navigateTo({
				url: `/pages/test/quickDetails?id=${val.id}`
			})
		}
	}

	const onReply = (val) => {
		emit('onReply', val)
	}
</script>

<style lang="scss" scoped>
	.box-model {
		align-items: stretch;

		.item {
			&:nth-child(3n) {
				margin-right: 0;
			}
		}
	}
</style>